<?php
	require_once 'Controllers/UserController.php';
	require_once 'Helpers/DbHelper.php';

	$u = new UserController();
	if(isset($_POST))
	{
		if(isset($_POST['user-id']) && isset($_POST['password']) && isset($_POST['user-type-id']))
		{
			$u->login();
		}
	}
?>
<html>
<title>School Enrolment :: Login</title>
<head>
  <link type="text/css" rel="stylesheet" href="assets/styles.css" />
</head>
  <body>
    <div class="container">
      <form name="login-form" method="POST">
      <table width="400" align="center" cellspacing="0" cellpadding="0" id="login-form">
        <tr>
          <td><label for="user-id">ID:</label></td>
          <td><input type="text" name="user-id"  /></td>
		  <td><label for="user-type-id">Login as:</label></td>
		  <td>
			<select name="user-type-id">
			  <?php
				$result = $u->getUserTypes();
				while($type = mysql_fetch_array($result))
				{
					$s = $type['Name'];
					$i = $type['Id'];
					echo "<option value='$i'>$s</option>";
				}
			  ?>
			</select>
		</td>
        </tr>
        <tr>
          <td><label for="password">Password:</label></td>
          <td><input type="password" name="password" /></td>
        </tr>
        <tr>
          <td><input type="submit" name="login" value="Login" />
        </tr>
      </table>
    </div>
  </body>
</html>
